//
//  BackCircleView.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/17.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "BackCircleView.h"
#import "CommonMacro.h"

@interface BackCircleView ()
{
    UIButton *popularCircleButton;
    UIButton *recomendCircleButton;
}
@end

@implementation BackCircleView

- (id)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self addSubviews];
    }
    return self;
}

#pragma mark 创建子控件
- (void)addSubviews
{
    //左侧按钮
    UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 16, 60, 60)];
    [backButton setImage:[UIImage imageNamed:@"返回"] forState:UIControlStateNormal];
    backButton.tag = 1000;
    [self addSubview:backButton];
    [backButton addTarget:self action:@selector(clickButtonDone:) forControlEvents:UIControlEventTouchUpInside];
    
    //热门圈子
    popularCircleButton = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH*0.2, 60, SCREEN_WIDTH*0.25, 30)];
    [popularCircleButton setTitle:@"热门圈子" forState:UIControlStateNormal];
//    popularCircleButton.backgroundColor = [UIColor blackColor];
    [popularCircleButton.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
    popularCircleButton.layer.cornerRadius = 14;
    popularCircleButton.clipsToBounds = YES;
    popularCircleButton.tag = 1001;
    [self addSubview:popularCircleButton];
    [popularCircleButton addTarget:self action:@selector(clickButtonDone:) forControlEvents:UIControlEventTouchUpInside];
    [popularCircleButton setBackgroundImage:[UIImage imageNamed:@"试用详情底部按钮"] forState:UIControlStateNormal];
    [popularCircleButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [popularCircleButton setBackgroundImage:[UIImage imageNamed:@"推荐圈子-底框"] forState:UIControlStateSelected];
    [popularCircleButton setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
    popularCircleButton.selected = YES;
    self.lastButton = popularCircleButton;
    
    //推荐圈子
    recomendCircleButton = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH*0.55, 60, SCREEN_WIDTH*0.25, 30)];
    [recomendCircleButton setTitle:@"推荐圈子" forState:UIControlStateNormal];
//    recomendCircleButton.backgroundColor = [UIColor blueColor];
    [recomendCircleButton.titleLabel setFont:[UIFont boldSystemFontOfSize:15]];
    recomendCircleButton.layer.cornerRadius = 14;
    recomendCircleButton.clipsToBounds = YES;
    recomendCircleButton.tag = 1002;
    [self addSubview:recomendCircleButton];
    [recomendCircleButton addTarget:self action:@selector(clickButtonDone:) forControlEvents:UIControlEventTouchUpInside];
    [recomendCircleButton setBackgroundImage:[UIImage imageNamed:@"试用详情底部按钮"] forState:UIControlStateNormal];
    [recomendCircleButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [recomendCircleButton setBackgroundImage:[UIImage imageNamed:@"推荐圈子-底框"]forState:UIControlStateSelected];
    [recomendCircleButton setTitleColor:[UIColor redColor] forState:UIControlStateSelected];
}

#pragma mark 点击按钮后使用时间
- (void)clickButtonDone:(UIButton *)button
{
    if ([self.changeAndBackDelegate respondsToSelector:@selector(changeDifferentCircleAndBack:)]) {
        [self.changeAndBackDelegate changeDifferentCircleAndBack:button];
    }
}

@end
